*-------------------------------------------------------------------------------
* TITLE: 0.master.do
* DESCRIPTION: Master file to set directories and run all analyses
* VERSION: MP17.0
* DATE: 08/23/21 
*-------------------------------------------------------------------------------

	/* NOTE:
		The following stata packages are required for the replication code to run:
		
		 grc1leg
		 renvars
		 eststo
		 twoway_parea
		 distplot
		 diptest
		 trimmean 
		 grstyle 
		 kdens
		 moremata
		 catplot
	*/


**------------------------------------------------------------------------------
** SETTINGS
**------------------------------------------------------------------------------
clear all
set more off
set maxvar 30000
set matsize 3000
mata: mata clear


**------------------------------------------------------------------------------
** SET DIRECTORIES
**------------------------------------------------------------------------------

	// SET FILE DIRECTORY HERE
global user ".../Why Do People Stay Poor - replication files/replication files"

cd "$user"


global Data "${user}/Data"
global Output "${user}/Results"
global Do "${user}/Code"
global stest "${user}/shape test and P-spline"
global asset_densities "${user}/Asset Densities"



**------------------------------------------------------------------------------
** RUN ANALYSES
**------------------------------------------------------------------------------

* DATA CREATION
do "${Do}/1.data_creation.do"

* TABLES
do "${Do}/2.tables.do"

* REDUCED FORM FIGURES
do "${Do}/3.figures.do"

* STRUCTURAL ESTIMATION
do "${Do}/structural/0_structural_master.do"

* ONLINE APPENDIX
do "${Do}/4.appendix_figures.do"
do "${Do}/5.appendix_tables.do"

